package com.centaline.androidsalesblog.rx.database;

import com.centaline.androidsalesblog.constants.CommonConstant;
import com.centaline.androidsalesblog.model.businissobject.DropBo;

import java.util.ArrayList;

import rx.Observable;
import rx.Subscriber;

/**
 * 下拉菜单-附近
 * Created by guilin on 16/1/25.
 */
final class NearByOnSubscribe implements Observable.OnSubscribe<DropBo> {

    @Override
    public void call(Subscriber<? super DropBo> subscriber) {
        final ArrayList<DropBo> list = new ArrayList<>();
        DropBo result = new DropBo(11);
        result.setText("附近");
        result.setValue(CommonConstant.DROP_VALUE_NULL);
        DropBo dropBo = new DropBo(11);
        dropBo.setText("1km");
        dropBo.setValue("1000");
        list.add(dropBo);
        dropBo = new DropBo(11);
        dropBo.setText("1.5km");
        dropBo.setValue("1500");
        list.add(dropBo);
        dropBo = new DropBo(11);
        dropBo.setText("2km");
        dropBo.setValue("2000");
        list.add(dropBo);
        result.setChildrenList(list);
        if (!subscriber.isUnsubscribed()) {
            subscriber.onNext(result);
        }
        subscriber.onCompleted();
    }

}
